#pragma once
#ifndef __G_VECTOR_2_H__
#define __G_VECTOR_2_H__

#include "GUtilities/GTypes.h"

namespace GMath
{

	class GVector2
	{
	public:
		static const GVector2	Zero;
		static const GVector2	One;
		static const GVector2	UnitX;
		static const GVector2	UnitY;
		static const GVector2	Min;
		static const GVector2	Max;	


		union
		{
			struct
			{
				float		x;
				float		y;
			};

			float			Arr[2];
		};
	
							GVector2();
							GVector2(float Vx, float Vy);

							operator float* ();
							operator const float* ()const;

		float				Lenght() const;
		float				LenghtSqr() const;

		float				Distance(const GVector2& Vector) const;
		float				DistanceSqr(const GVector2& Vector) const;

		static void			Maximum(OUTPUT GVector2& Output, const GVector2& Vector1, const GVector2& Vector2);
		static void			Minimum(OUTPUT GVector2& Output, const GVector2& Vector1, const GVector2& Vector2);

		void				Saturate();
		static void			Saturate(OUTPUT GVector2& Output, const GVector2& Vector);

		void				Normalize();
		static void			Normalize(OUTPUT GVector2& Output, const GVector2& Vector);

		void				Absolute();
		static void			Absolute(OUTPUT GVector2& Output, const GVector2& Vector);

		void				Scale(float Value);
		static void			Scale(OUTPUT GVector2& Output, const GVector2& Vector, float Value);

		void				Clamp(const GVector2& LimitLow, const GVector2& LimitUp);
		static void			Clamp(OUTPUT GVector2& Output, const GVector2& Vector, const GVector2& LimitLow, const GVector2& LimitUp);

		void				Lerp(const GVector2& Vector, float Amount);
		static void			Lerp(OUTPUT GVector2& Output, const GVector2& VectorA, const GVector2& VectorB, float Amount);

		float				Dot(const GVector2& Vector) const;
		static float		Dot(const GVector2& VectorA, const GVector2& VectorB);

		float				Cross(const GVector2& Vector) const;
		static float		Cross(const GVector2& VectorA, const GVector2& VectorB);

		GVector2&			operator += (const GVector2& Vector);
		GVector2&			operator -= (const GVector2& Vector);
		GVector2&			operator *= (const GVector2& Vector);
		GVector2&			operator /= (const GVector2& Vector);
		GVector2&			operator *= (const float Value);
		GVector2&			operator /= (const float Value);

		GVector2			operator + () const;
		GVector2			operator - () const;

		GVector2			operator + (const GVector2& Vector) const;
		GVector2			operator - (const GVector2& Vector) const;
		GVector2			operator * (const GVector2& Vector) const;
		GVector2			operator / (const GVector2& Vector) const;
		GVector2			operator * (float Value) const;
		GVector2			operator / (float Value) const;

		bool				operator == (const GVector2& Vector) const;
		bool				operator != (const GVector2& Vector) const;

		friend GVector2		operator * (float Value, const GVector2& Vector);
		friend GVector2		operator / (float Value, const GVector2& Vector);
	
	};

}

#endif